package com.tang.common.uniform;

import com.tang.common.exception.RecruitException;
import com.tang.common.exception.RecruitExceptionEnum;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Constant {
    public static String UPLOAD_DIR ="";
    public static String CAPTCHA="captcha";

    //MD5加密盐值
    public interface System{
        String SALT = "abcd@,.?";
    }
    public enum DeliverStatusEnum{
        HAS_DELIVER(0,"已投递"),
        VIEWED(10,"被查看"),
        WRITTEN(20,"笔试"),
       INTERVIEW(30,"面试"),
        PASS(40,"通过"),
        OFFER(50,"发放offer"),
        NOT_PASS(60,"未通过");
        private String value;
        private int code;

        DeliverStatusEnum(int code,String value) {
            this.value = value;
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }
        public static DeliverStatusEnum codeOf(int code){
            for (DeliverStatusEnum deliverStatusEnum : values()) {
                if(deliverStatusEnum.getCode() == code){
                    return  deliverStatusEnum;
                }
            }
            throw new RecruitException(RecruitExceptionEnum.NO_ENUM);
        }
    }
    public enum UserRole{
        USER(0,"普通用户"),
        ADMIN(1,"企业用户");
        private Integer code;
        private String msg;

        UserRole(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }
}
